<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<link href="../../../css/mui.css" rel="stylesheet" />
		<link href="../../../css/common.css" rel="stylesheet" />

		<style>
		.mui-table-view{
			margin-top: 0px !important;
		}
		.mui-control-content {
			background-color: white;
			min-height: 760px;
		}
		.mui-scroll-wrapper{
			/* margin-top: 4px; */
		}
		.mui-table-view-cell {
			border-bottom: 1px solid rgba(200,200,200,0.2);
			font-size: 15px;
			width: 100%;
			height: 60px;
			line-height: 60px;
			padding: 0 15px;
		}
		.pass-tips{
			font-size: 12px;
			color: darkgoldenrod;
		}
		.mui-table-view-cell label{
			float: left;
			width: 25%;
		}
		.mui-table-view-cell input{
			height: 60px;
			float: left;
			font-size: 15px; 
			width: 75%; 
			border: none;
		}
		.btn-update-password{
			color: white; 
			background-color: #007AFF;
			width: 95%;
			height: 50px;
			margin: 10px;
		}
		.getcode{
			float: right;
			width: 30%;
			height: 40px;
			color: white; 
			background-color: goldenrod;
			margin-top: 10px;
		}
		</style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left touch-action"></a>
			<h1 class="mui-title">重置交易密码</h1>
		</header>

		<div id="mui-content">

			<div id="slider" class="mui-slider touch-action">
				<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<a class="mui-control-item" href="#item1mobile">
						修改登录密码
					</a>
				</div>
				<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-6"></div>

				<div class="mui-slider-group">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll">
								<ul class="mui-table-view item1ul">
									<li class="mui-table-view-cell" >
										<p class="pass-tips">支付密码是您在芯芝麻的支付密码，与您的银行卡密码无关</p>
									</li>
									<li class="mui-table-view-cell" >
										<label>原密码</label>
										<input class="inp" type="text" placeholder="请输入6位旧密码" v-model="origin_password">
									</li>
									<li class="mui-table-view-cell">
										<label>新密码</label>
										<input class="inp" type="text" placeholder="请输入6位新密码" v-model="password">
									</li>
									<li class="mui-table-view-cell">
										<label>确认新密码</label>
										<input class="inp" type="text" placeholder="请重新输入6位新密码" v-model="confirm_password">
									</li>
								</ul>
								<button type="button" class="mui-btn mui-btn-outlined btn-update-password" id="btn-update-password">确认修改</button>
							</div>
						</div>
					</div>
				</div>
			</div>

		</div>

		<script src="../../../js/mui.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/md5.min.js"></script>
		<script src="../../../js/vue.min.js"></script>
		
		<script type="text/javascript">
			mui.init()
			mui.plusReady(function(){
					document.getElementById("btn-update-password").addEventListener("tap",function(){
					var token=localStorage.logintoken;
					//vue.js的数据
					var data =JSON.parse(JSON.stringify(vm.$data));  //复制数据; 因为默认传的是引用;
					data["token"]=token;
							
					//验证数据
					if(!data.origin_password || data.origin_password=="")
					{
						mui.toast("请填写原密码！");
						return false;
					}
					if(!data.password || data.password=="")
					{
						mui.toast("请填写新密码！");
						return false;
					}
					if(!data.confirm_password || data.confirm_password=="")
					{
						mui.toast("请填写确认新密码！");
						return false;
					}
					var signkey=localStorage.signkey;
					var signcode=sign(data,signkey);
					
					data['sign']=signcode;
					
					var url=address("/api/User/updateTransactionPassword");
					mui.post(url,
					data,
					function(data){
						console.log(JSON.stringify(data));
						if (data.code == 1 && (typeof(token) != undefined)) {
							localStorage.userinfo=JSON.stringify(data.data);
							plus.nativeUI.toast(data.msg);
						}else{
							plus.nativeUI.toast(data.msg);
						}
						let clearinp = document.getElementsByClassName('inp');
						for(let key in clearinp){
							clearinp[key].value = '';
						}
					},'json')
				})
		});
		var vm= new Vue(
		{
			el:'#mui-content',
			data: {
				origin_password:null,
				password:null,
				confirm_password:null,
			},
			methods:{
				checkData:function(e){
				},
			}
		});
		</script>
	</body>

</html>
